<?php 
define('_VIEW_MODEL_','admin');
session_start();
$statu = $_SESSION['statu'];
require_once("../init.php");
$info = "";
$bookname ="";
if(!$statu){
	echo "<script>window.parent.location.href='./index.php'</script>";
}
if(isset($act)&&$act=="addadmin"){
	$id = intval($id);
	//echo "select bookname,bookmember from {$telper}bbs_book where id = $id";
	$info = $db->GetRow("select bookname,bookmember from {$telper}bbs_book where id = $id");
	$bookname = $info['bookname'];
}else{
	$act = "add";
	$id  = "";
}
if(isset($action)&&$action == 'addadmin'){
	$bookid = intval($bookid);
	$id     = intval($bookadmin);
	$nasty  = "usename".$id;
	$name   = $$nasty;
	$ti     = time();
	$db->Execute("insert into {$telper}bbs_admin set columnid = '0',userid='$id',username='$name',created = '$ti'");
	header("Location:bookbbscont.php");
	exit;
}
$smartyObj->assign('title',$admintitle);
$smartyObj->assign('adminbbstitle',$bookbbsadd);
$smartyObj->assign('info',$info);
$smartyObj->assign('bookid',$id);
$smartyObj->assign('act',$act);
$smartyObj->assign('bookname',$bookname);
$smartyObj->display("bookbbsadd.tpl");
?>